package com.estar.integaration.Reader;

import com.alibaba.excel.EasyExcel;
import com.estar.integaration.Reader.Listener.DueReceiptDetailListener;
import com.estar.integaration.entity.paymentPlanEntity.DueReceiptDetail;

import java.util.ArrayList;
import java.util.List;

/**
 * Author: YJL
 * Date: 2022/2/17 15:43
 * 应付帐单细节表
 * 应付单.xlsx
 **/
public class DueReceiptDetailReader {

  List<String> addresses = new ArrayList<>();
  List<DueReceiptDetail> dueReceiptDetailList = new ArrayList<>();

  public DueReceiptDetailReader(List<String> addresses) {
    this.addresses = addresses;
  }

  public List<DueReceiptDetail> readDueRD(){

    for(String address : addresses){
      List<DueReceiptDetail> tmpList = new ArrayList<>();
      EasyExcel.read(address,DueReceiptDetail.class,new DueReceiptDetailListener(tmpList))
          .sheet(0)
          .headRowNumber(1)
          .doRead();
      dueReceiptDetailList.addAll(tmpList);
    }
    return dueReceiptDetailList;
  }

}
